public class Solution941 {
    public boolean validMountainArray(int[] arr) {
        if (arr.length<3){
            return false;
        }
        int t=0;
        while (t<arr.length-1 && arr[t]<arr[t+1]){
            t++;
        }
        if (t==arr.length-1 || t==0){
            return false;
        }
        while (t<arr.length-1 && arr[t]>arr[t+1]){
            t++;
        }
        return t == arr.length - 1;
    }

    public static void main(String[] args) {
        System.out.println(new Solution941().validMountainArray(new int[]{0,3,2,1}));
    }
}
